home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The PC-SIG Library 9
/
The PC-SIG Library on CD ROM - Ninth Edition.iso
/
1601_700
/
DISK1665
/
DISK1665.ZIP
/
LANGDBA4.KED
< prev
next >
Wrap
Text File
|
1989-03-17
|
41KB
|
1,057 lines
.Notice - Last Update:1988/11/17 17:30
Importance Notice: The information contained in this option are for quick
reference only. The accuracy of it should be based on your
language manual.
Set Up By : Kuang H. Tseng
Language : dBASE IV(TM) by ASHTON-TATE
. 1. Language Elements
Character Set - A to Z,a to z,0 to 9,underscore(_)
Data Type - (refer to separate key line for more)
System Variables - (refer to separate key line for more)
Memory Variables - (refer to separate key line for more)
Array - (refer to separate key line for more)
Macro substitution - (refer to separate key for more)
Operators - (refer to separate key line for more)
Commands - (refer to separate key line for more)
Functions - (refer to separate key line for more)
Program Line - contain command with up to 256-character long,
command verb may be abbreviated to four-letter long,
a command line may ends with ';' and continue to next line
Program Structure
SQL - (refer to separate key line for more)
Limitations - (refer to separate key line for more)
File Type - (refer to separate key line for more)
. 2. Data Types
Character - made up of the set of all ASCII characters
Numeric - largest number 1 X 10^308,smallest 1 X 10^-30,accuracy 15-16 digit
- represent numbers with IEEE long real (64 bit) binary floating pt
Logical - one byte long and contain a value of true(.T.) or false(.F.)
Date - stored internally as the number of days since a base date
- format MM/DD/YY(American) and DD/MM/YY(European)
Memo - store blocks of ASCII data, store in a file with extension .DBT
- Up to 64k of text in a single field
. 3.1 Identifiers
- Memory variables and field names have same naming convention
- Must start with a character
- May contain an embedded underline
- Can be up to 10 character long
- Case insensitive
. 3.2 Memory Variables
- use to temporarily store information in the memory
- create with STORE command or assignment operator
- naming of a memory variable as for identifiers (3.1)
- the type of the memory variable is same as the value stored in it
- to make the variable available to all procedures, declare it with PUBLIC
command. PRIVATE command is used to localize the scope
. 3.3 System Variables
_alignment = <"LEFT/center/right"> alignment of output page
_box = <expL> controls printing defined boxes
_indent = <expN> inden. of first line in paragraph
_lmargin = <expN> page left margin
_padvance = <"FORMFEED/linefeeds"> controls printer advances
_pageno = <expN> determines or set page number
_pbpage = <expN> beginning page for the printjob
_pcolno = <expN> positions column for printhead
_pcopies = <expN> number of copies for printjob
_pdriver = <expN> activate printer driver
_pecode = <expC> ending cotrol codes for printjob
_peject = <"before/after/both/NONE"> controls ejecting of pager
_pepage = <expN> page number to end the printjob
_pform = <print form filename> activates the print form file
_plength = <expN> sets length of printed page
_plineno = <expN> pnsitions the line on the page
_ploffset = <expN> sets page left offset for print
_ppitch = <"pica/elite/condensed/DEFAULT"> sets the printer pitch
_pquality = <expL> selects quality or draft mode
_pscode = <expC> provides starting control codes
_pspacing = <1/2/3> sets line spacing for output
_pwait = <expL> controls the wait for each page
_pwidth = <expN> sets width of print page
_rmargin = <expN> sets the page right margin
_tabs = [<expC1,...>] sets tabs for output
_wrap = <expL> sets word wrapping
. 3.4 Arrays
- memory variables may be declared as one/two-dimensional arrays
- the limit on the number of arrays is determined by available memory
- create an array with DECLARE command,i.e., DECLARE memvar[5,5]
- initialize elements of an array same way as for regular memory variables
- element of the array is accessed by including the number of the element
in square brackets, i.e., memvar[3,2] for element of 3th row,2nd column
. 3.5 Macro Substitution
- used to substitute the contents of a character memory variable in the
command line.
- the memory variable to be substituted must be preceded by the ampersand
'&'.
- macros can not contain commands or any part of a command including commas
. 4. Operators
Mathematical Operators
+ addition % modulus
- subtraction ** or ^ exponentiation
* multiplication () groups sets of numbers
/ division
Relation Operators
< less than > greater than
= equal to <>,#,or != not equal to
<= less than or equal to >= greater than or equal to
$ is a subset of == compares for a perfect match
Logical Operator
.AND. both expressions are true
.OR. either expression is true
.NOT. or ! either expression is false
$ first char expreesion is contained in second char expression
String Operator
+ concatenation
- concatenation with removing the trailing blanks on first string
$ substring comparison
. 5.1 List of Commands by Class/Group
Creation of Files
Modifying of Files
Addition of Data in Databases
Editting of Data in Databases
Displaying of Data
Manipulating Databases
Manipulating Record Pointer Position
Manipulating Memory Variables
Setting Parameters
Debugging Program
Program Flow Control
Miscellaneous
. 5.2 List of Commands by Name and Syntax in Name order
?/?? <exp list>
???
@ <row,col> [SAY <exp> [PICTURE <clause>]][FUNCTION <func list>]
[GET <var> [[OPEN] WINDOW <window name>][PICTURE <clause>]
[FUNCTION <func list>]
[RANGE <low expN>,<high expN>][VALID <cond>][ERROR <expC>]]
[WHEN <cond>][DEFAULT <exp>]<MESSAGE <expC>]
[COLOR [<standard>][,<enhanced>]]]
@ <row1,col1> [CLEAR] TO <row2,col2>]
@ <row1,col1> FILLL TO <row2,col2>[COLOR <color attr>]
@ <row1,col1> TO <row2,col2>[DOUBLE/PANEL/<border def.strg>][COLOR <color attr>]
ACCEPT [<prompt>] TO <memvar>
ACTIVATE MENU <menu name> [PAD <pad name>]
ACTIVATE POPUP <popup name>
ACTIVATE SCREEN ?????
ACTIVATE WINDOW <window name list>/ALL
APPEND [BLANK]
APPEND FROM <filename>/? [FOR <cond>][TYPE]<file type>]
APPEND FROM ARRAY [FOR <cond>]
APPEND MEMO <memo field name> FROM <filename> [OVERWRITE]
ASSIST
AVERAGE <expN list> [<scope>][WHILE <cond>][FOR <cond>][TO <memvar list>/
TO ARRAY <array name>]
BEGIN TRANSACTION [<pathname>]...END TRANSACTION
BROWSE [NOINIT][NOFOLLOW][NOAPPEND][NOMENU][NOEDIT][NODELETE][NOCLEAR][COMPRESS]
[FORMAT][LOCK <expN>][WIDTH <expN>][FREEZE <field name>][WINDOW <w.name>]
[FIELDS<field name 1>[/R][/<column width>]/<calculated field name 1> =
<expression 1>[,...]]
CALCULATE [scope] <AVG(expN>)/CNT()/MAX(exp>/MIN(<exp>)/NPV(<rate>,<flows>,
<initial>)/STD(<expN>)/SUM(<expN>)/VAR(<expN>)[FOR <cond>]
[WHILE <cond>][TO <memvar list>/TO ARRAY <array name>]
CALL <module name> [WITH <var>]
CANCEL
CHANGE [NOINIT][NOFOLLOW][NOAPPEND][NOMENU][NOEDIT][NODELETE][NOCLEAR][<recno>]
[FIELDS <field list>][<scope>][FOR <cond>][WHILE <cond>]
CLEAR [ALL/FIELDS/GETS/MEMORY/MENUS/POPUPS/TYPEHEAD/WINDOWS]
CLOSE ALL/ALTERNATE/DATABASES/FORMAT/INDEX/PROCEDURE
COMPILE <filename>
CONTINUE
CONVERT [TO <expN>]
COPY FILE <filename> TO <filename>
COPY INDEXES <.ndx file list> [TO <.mdx filename>]
COPY MEMO <memo field name> TO <filename> [ADDITIVE]
COPY STRUCTURE TO <filename> [FIELDS <field list>]
COPY TAG <tag name> [OF .mdx filename] TO <.ndx filename>
COPY TO ARRAY <array name>[FIELDS <field list>][<scope>]
[FOR <cond>][WHILE <cond>]
COPY TO <file name> [[TYPE] <filetype>][FIELDS <field list>][<scope>]
[FOR <cond>][WHILE <cond>]
COPY TO <file name> STRUCTURE EXTENDED
COUNT [<scope>][WHILE <cond>][FOR <cond>][TO <memvar>]
CREATE <.dbf filename>
CREATE APPLICATION <filename>/?
CREATE <filename> FROM <structure extended file>
CREATE LABEL <.lbl filename>/?
CREATE QUERY <.qry filename>/?
CREATE REPORT <.frm filename>/?
CREATE SCREEN <.scr filename>/?
CREATE VIEW <.vue filename> FROM ENVIRONMENT
DEACTIVATE MENU
DEACTIVATE POPUP
DEACTIVATE WINDOW <window name list>/ALL
DEBUG <filename>/<proc name> [WITH <parm list>]
DECLARE <array name 1>[<number of rows>[,<number of col>]]...]
DEFINE BAR <line number> OF <popup name> PROMPT <expC>[MESSAGE <expC>]
[skip [for <cond>][NOSPACE]]
DEFINE BOX FROM <print col> TO <print col> HEIGHT <exp> [AT LINE <print line>]
[SINGLE/DOUBLE/<border definition string>]
DEFINE MENU <menu name> [MESSAGE <expC>]
DEFINE PAD <pad name> OF <memu name> PROMPT <expC> [AT <row>,<col>]
[MESSAGE <expC>]
DEFINE POPUP <popup name> FROM <row1> <col1>[TO <row2> <col2>][PROMPT FIELD
<field name>/PROMPT FILES [LIKE <skelton>]/[PROMPT STRUCTURE]
[MESSAGE <expC>]
DEFINE WINDOW <window name> FROM <row1>,<col1> TO <row2>,<col2> [DOUBLE/PANEL/
NONE/<border definition string>][COLOR [<standard>][,<enhanced>][,<frame>]]
DELETE [<scope>][WHILE <cond>][FOR <cond>]
ERASE FILE <filename>/?
DELETE TAG <tag name1> [OF <.mdx filename>]/<.ndx filename1>[,...]
DIR [[ON] <drive:>][[LIKE] <pathname>\][<mask>]
DISPLAY [FIELDS] <exp list>][OFF][<scope>][<exp list>][FOR <cond>]
[TO PRINTER/TO FILE <filename>]
DISPLAY HISTORY [LAST <expN>[TO PRINTER/TO FILE <filename>]
DISPLAY MEMORY [TO PRINTER/TO FILE <filename>]
DISPLAY STATUS [TO PRINTER/TO FILE <filename>]
DISPLAY STRUCTURE [IN <alias name>][TO PRINTER/TO FILE <filename>]
DISPLAY USERS
DO <.prg filename>/<procedure name>[WITH <parm list>]
DO CASE ... CASE...[OTHERWISE]...ENDCASE
DO WHILE ...[LOOP] [EXIT] ENDDO
EDIT [NOINIT][NOFOLLOW][NOAPPEND][NOMENU][NOEDIT][NODELETE][NOCLEAR][<recno>]
[<scope>][FIELDS <field list>][WHILE <cond>][FOR <cond>]
EJECT
ERASE <filename>/?
EXIT
EXPORT TO <filename> [TYPE] PFS/DBASE II/FW2/RPD FIELDS <field list>][<scope>]
[FOR <cond>][WHILE <cond>]
FIND <literal key>/<n>
FUNCTION <procedure name>
GO/GOTO BOTTOM/TOP [IN <alias name>]
GO/GOTO [RECORD] <rec no> [IN <alias name>]
HELP [<dBASE IV keyword>]
IF <cond> ... [ELSE ...] ENDIF
IMPORT FROM <filename> [TYPE] PFS/DBASEII/FW2/RPD/WK1
INDEX ON <key exp> TO <.ndx filename> TAG <tag name> [OF <.mdx filename>]
[UNIQUE][DESCENDING]
INPUT [<prompt>] TO <memvar>
INSERT [BLANK] [BEFORE]
JOIN WITH <alias> TO <new file> FOR <cond> [FIELDS <field list>]
LABEL FORM <.lbl filename>/? [<scope>][SAMPLE][WHILE <cond>]
[FOR <cond>][TO PRINT/TO FILE <filename>]
LIST [FIELDS] <exp list>][OFF][<scope>][<exp list>][FOR <cond>]
[TO PRINTER/TO FILE <filename>]
LIST HISTORY [LAST <expN>[TO PRINTER/TO FILE <filename>]
LIST MEMORY [TO PRINTER/TO FILE <filename>]
LIST STATUS [TO PRINTER/TO FILE <filename>]
LIST STRUCTURE [IN <alias name>][TO PRINTER/TO FILE <filename>]
LIST USERS
LOAD <.exe/.com filename>
LOCATE [<scope>] [WHILE <cond>] [FOR <cond>]
LOGOUT
LOOP
MODIFY COMMAND/FILE <filename> [WINDOW <window name>]
MODIFY <.dbf filename>
MODIFY APPLICATION <filename>/?
MODIFY <filename> FROM <structure extended file>
MODIFY LABEL <.lbl filename>/?
MODIFY QUERY <.qry filename>/?
MODIFY REPORT <.frm filename>/?
MODIFY SCREEN <.scr filename>/?
MODIFY VIEW <.vue filename> FROM ENVIRONMENT
MOVE WINDOW <window name> TO <row><column> /BY <rowcnt>,<colcnt>
NOTE/*/&&
ON ERROR/ESCAPE [<command>]
ON KEY [<key label name>][<command>]
ON PAD <pad name> OF <menu name> [ACTIVE POPUP <popup name>]
ON PAGE [AT LINE <expN> <command>]
ON READERROR [<command>]
ON SELECTION PAD <pad name> OF <memu name> [<command>]
PACK
PARAMETERS <parm list>
PLAY MACRO <macro name>
PRINTJOB <commands> ENDPRINTJOB
PRIVATE ALL [LIKE/EXCEPT <skelton>]
PRIVATE <memvar list>/ARRAY <array definition list>
PROCEDURE <proc name>
PROTECT
PUBLIC <memvar list>/[ARRAY <array definition list>]
QUIT
READ [SAVE]
RECALL [<scope>] [WHILE <cond>][FOR <cond>]
REINDEX
RELEASE <memvar list>
RELEASE ALL [LIKE/EXCEPT <skelton>]]
RELEASE MODULE <module name> /MENUS <menu name list>/POPUPS <popup name list>/
WINDOW <window name list>
RENAME <old filename> TO <new filename>
REPLACE [<scope>] <field1> WITH <exp1> [,<field2> WITH <exp2,...]
[WHILE <cond>][FOR <cond>][ADDITIVE]
REPORT FORM <.frm filename>/? [<scope>][WHILE <cond>][FOR <cond>][PLANT]
[HEADING <expC>][NOEJECT]]SUMMARY][TO PRINTER/TO FILE <filename>]
RESET [IN <alias name>]
RESTORE FROM <.mem filename> [ADDITIVE]
RESTORE MACRO FROM <macro filename>
RESTORE WINDOW <window name list>/ALL FROM <filename>
RESUME
RETRY
RETURN [TO MASTER] [<expression>]
ROLLBACK [<.dbf filename>]
RUN/! <DOS command>
SAVE TO <mem filename> [ALL LIKE/EXCEPT <skelton>]
SAVE MACROS TO <macro filename>
SAVE WINDOW <window name list> /ALL TO <filename>
SCAN [<SCOPE>][FOR <cond>][WHILE <cond>]...[LOOP]...[EXIT]...ENDSCAN
SEEK <exp>
SELECT <work area/alias>
SET --- refer to the key line List of SET commands
SHOW MENU <menu name> [PAD <pad name>]
SHOW POPUP <popup name>
SKIP <expN>[IN <alias name>]
SORT TO <new filename> ON <field1>[/A][/C][/D][,<field2>[/A][/C][/D]...]
[<scope>][WHILE <cond>][FOR <cond>][ASCENDING]/[DESCENDING]
STORE <exp> TO <memvar list>/<array element list>
SUM [<scope>] [<expN list>] TO [<memvar list>/TO ARRAY <array name>]
[WHILE <cond>][FOR <cond>]
SUSPEND
TEXT <text characters> ENDTEXT
TOTAL TO <filename> ON <key field> [<scope>] [FIELDS <field list>]
[WHILE <cond>][FOR <cond>]
TYPE <filename> [NUMBER][TO PRINTER/TO FILE <filename>]
UNLOCK [ALL/IN <alias name>]
UPDATE ON <key field> FROM <alias> REPLACE <field1> WITH <exp>
[,<field2> WITH <exp2>...][RANDOM]
USE [<.dbf filename>/?] [IN <work area number>]
[INDEX <.ndx/.mdx file list>][ALIAS <alias>]
[ORDER <.ndx filename>/<.mdx tag> [OF <.mdx filename>]]
WAIT [<prompt>] [TO <memvar>]
ZAP
. 5.3 List of SET commands
SET ALTERNATE on/OFF
SET ALTERNATE TO [<text filename>][ADDITIVE]
SET AUTOSAVE on/OFF
SET BELL ON/off
SET BELL TO [<frequency>,<duration>]
SET BLOCKSIZE TO <expN>
SET BORDER TO [SINGLE/DOUBLE/PANEL/NONE/<border definition string>]
SET CARRY on/OFF
SET CARRY TO [<field list>][ADDITIVE]
SET CATALOG on/OFF
SET CATALOG TO <.cat filename>/?
SET CENTURY on/OFF
SET CLOCK on/OFF
SET CLOCK TO [<row>,<col>]
SET COLOR ON/OFF
SET COLOR TO [N(black)/B(blue)/G(green)/BG(cyan)/R(red)/RB(magenta)/GR(brown)
/W(white)][,<enhanced>][,<perimeter>][,<background>]]
SET COLOR OF NORMAL/MESSAGES/TITLES/BOXES/HIGHLIGHT/ALERT FIELDS TO [<attr>]
SET CONFIRM OFF/on
SET CONSOLE ON/off
SET CURRENCY TO [<expC>]
SET CURRENCY LEFT/right
SET DATE AMERICAN/ansi/british/italian/french/german/japan/usa/mdy/dmy/ymd
SET DEBUG on/OFF
SET DECIMALS TO <expN>
SET DEFAULT TO <drive>
SET DELETED OFF/on
SET DELIMITERS OFF/on
SET DELIMITERS TO <expC>/DEFAULT
SET DESIGN ON/off
SET DEVELOPMENT on/OFF
SET DEVICE TO SCREEN/PRINTER/FILE <filename>
SET DISPLAY TO MONO/COLOR/EGA25/EGA43/MONO43
SET ECHO on/OFF
SET EMACRO on/OFF
SET ENCRYPTION ON/off
SET ESCAPE ON/off
SET EXACT OFF/on
SET EXCLUSIVE ON/off
SET FIELDS on/OFF
SET FIELDS TO [<field> [/R]/<calculated field id>...][,...]/ALL
[LIKE/EXCEPT <skelton>][ADDITIVE]
SET FILTER TO [FILE <filename>/?][<cond>]
SET FIXED OFF/on
SET FORMAT TO <.fmt filename>/?
SET FUNCTION <expN> TO <expC>
SET HEADING ON/off
SET HELP ON/off
SET HISTORY ON/off
SET HISTORY TO <expN>
SET HOURS TO [12/24]
SET INDEX TO <.ndx or .mdx file list>/?[ORDER <.ndx filename/TAG>
<.mdx tag name> [OF <.mdx filename.]]
SET INSTRUCT ON/off
SET INTENSITY ON/off
SET LOCK ON/off
SET MARGIN TO <expN>
SET MARK TO <expC>
SET MEMOWIDTH TO <expN>
SET MENUS ON/off
SET MESSAGE TO <expC>
SET NEAR on/OFF
SET ODOMETER TO [<expN>]
SET ORDER TO [<expN>]/[TAG <.mdx tag>/OF <.mdx filename>]]
SET PATH TO <path list>
SET POINT TO <expc>
SET PRECISION TO <expN>
SET PRINT OFF/on
SET PRINTER TO <DOS device>
SET PRINTER TO \\<computer name>\<printer name>=<dest.>/\\SPOOLER/\\CAPTURE
SET PRINTER TO FILE <filename>
SET PROCEDURE TO <procedure filename>
SET REFRESH TO <expN>
SET RELATION TO
SET RELATION TO <key exp>
SET RELATION TO <expN1> INTO <alias1>[<expN2> INTO <alias2>...]
SET REPROCESS
SET SAFETY ON/off
SET SCOREBOARD
SET SEPARATOR TO [<expC>]
SET SKIP TO [<alias name1> [,<alias name2>...]]
SET SPACE ON/off
SET SQL on/OFF
SET STATUS ON/off
SET STEP OFF/on
SET TALK ON/off
SET TITLE ON/off
SET TRAP on/OFF
SET TYPEAHEAD TO <expN>
SET UNIQUE OFF/on
SET VIEW TO <query filename>/<.view filename>/?
SET WINDOW OF MEMO TO <window name>
. 5.4 List of Functions
& - macro substitution
ABS(<expN>) - absolute value
ACCESS() - access level of current user
ACOS(<expN>) - arccosine function
ALIAS([<expN>]) - alias name of a specified work area
ASC() - character to ASCII code conversion
ASIN(<expN>) - arcsine function
AT(<expC>,<expC>/memvar) - substring searc
ATAN(<expN>) - arctangent function
ATN2(<expN1>,<expN2>) - arctangent function for cosine and sine of points
BAR() - BAR number; of the most recently selected BAR from a pop-up menu
BOF(<alias>) - beginning of file
CALL (<filename>,<expC>/<memvar>) - execute binary program modules
CDOW(<expD>) - day of week
CEILING(<expN>) - smallest integer that is greater than or equal to the value
CHANGE() - determines if a record has been changed since it was opened
CHR(<expN>) - ASCII code to character conversion
CMONTH(<expD>) - calendar month
COL() - current screen column position
COMPLETED() - determine if a transaction has completed
COS(<expN>) - cosine function
CTOD(<expC>) - character to date conversion
DATE() - system date
DAY(<expD>) - day of month
DBF([<alias>]) - name of the database file in USE in the currently selected area
DELETE() - delete record
DIFFERENCE(<expc>,<expc>) - difference between two SOUNDEX() codes
DISKSPACE - free space on disk in bytes
DMY(<expD>) - converts the date to Day/Month/Year format from valid date exp.
DOW(<expD>) - day of week
DTOC(<expD>) - date to character conversion
DTOR(<expN>) - converts degrees to radians
DTOS(<expD>) - converts a date variable to a character string for indexing
EOF() - end of file
ERROR - number for ON ERROR condition
EXP(<expN>) - exponential
FIELD(<expC>) - number of fields in DBF file
FILE("<file>") - file existence
FKLABEL() - names of function keys
FKMAX() - maximum number of function keys
FLOAT(<expN>) - converts binary coded decimal numbers to long real floating no.
FLOCK([ALIAS]) - lock a database
FLOOR(<expN>) - largest integer that is less than or equal to the value
FOUND() - result of record search in DBF file
FV(<payment>,<rate>,<periods>) - future value of equal regular deposits
GETENV((<expC>) - return the contents of DOS environmental system variable
IIF(<expL>,<exp1>,<exp2>) - expression 1 or expression 2 based on expression L
INKEY(<expN>) - keypress during execution
INT(<expN>) - integer
ISALPHA(<expC>) - evalute for letter
ISCOLOR() - evaluate for color mode
ISLOWER() - evaluate for lower case
ISMARKED([<alias>]) - checks if database file header is in a state of change
ISUPPER() - evaluate for upper case
KEY([<.mdx file>,]<expN>[,<alias name>]) - key expression for the index file
LASTKEY() - decimal ASCII value of the last key pressed
LEFT() - substring selection from left side
LEN(<expc/<array>) - length of character string
LIKE(<pattern>,<expC>) - uses for wildcard comparisons
LINENO() - file relative line number of the line
LKSYS(n) - get log-in name of the user who has locked a record
LOG(<expN>) - logarithm
LOG10(<expN>) - logarithm based 10
LOOKUP(<return exp>,<look-for exp>,<look-in field>) - search and return a value
LOWER(<expC>) - upper to lower case conversion
LTRIM(<expC>) - remove leading blanks
LUPDATE() - last update of DBF file
MAX(<expN1>/(<expD1>,<expN2>/<expD2>) - determine greater of two values
MDX(<expN>[,<alias name>]) - get filename for the .mdx file spec.
MDY(<expD>) - converts date format to Month,Day,Year
MEMLINES(<memo field name>) - get number of lines in a memo field
MEMORY([0]) - get the amount of RAM unused
MENU() - name of active menu
MESSAGE() - message corresponding to the error
MIN() - determine smaller of two values
MLINE(<memo field name>,<expN>) - extracts a line of text from a memo field
MOD() - MODULUS
MONTH(<expD>) - month of year
NDX(<expN>,[<alias name>]) - name of an .ndx file or an .mdx tag
NETWORK() - determines if the system is running on a network
ORDER([<alias name>]) - name of the primary order index file or .mdx tag
OS() - name of OS
PAD() - returns the prompt PAD name of the last selected PAD of the active menu
PAYMENT (<principal>,<rate>,<periods>) - payment of loan amortization
PCOL() - printer column position
PI() - returns the number of PI
POPUP() - name of the active pop-up menu
PRINTSTATUS() - checks if printer is ready
PROGRAM() - returns the name of program or procedure when an error occurred
PROMPT() - returns the PROMPT of the selected popup or menu option
PROW() - printer row position
PV (<paymeny>,<rate>,<periods>) - calculates the present value of payments
RAND([<expN>]) - generates a random number
READKEY() - determine full-screen exiting keypress
READVAR () - creates context sensitive help displays
RECCOUNT() - number of records in DBF file
RECNO() - current record number
RECSIZE - size of record
REPLICATE(<expC>,<expN>) - repeat character expression
RIGHT() - substring selection from right side
RLOCK/LOCK([<expC list>][,<alias name>]) - lock multiple records
ROLLBACK() - determines if the last ROLLBACK command was successful
ROUND() - rounds off
ROW() - current screen row position
RTOD(<expN>) - converts radians to degrees
RTRIM() - remove trailing blanks
SEEK(<expC> [,<alias name>]) - performs lookup in indexed database
SELECT() - returns the number of the highest unused work area
SET (detail refer to SET Key)
SIGN(<expN>) - returns the sign of a number
SIN(<expN>) - sine function
SOUNDEX(<expC>) - provides a phonetic match or sound-alike code
SPACE(<expN>) - generates blank spaces
SQRT(<expN>) - square root
STR() - numeric to character conversion
STUFF() - replace portion of string
SUBSTR - substring selection
TAG([.mdx file>,] <<expN>[,<alias name>]) - return the TAG name
TAN(<expN>) - tangent function
TIME() - system time
TRANSFORM - character/numeric in PICTURE format
TYPE("<expC>") - validates expression
UPPER(<expC>) - lower to upper case conversion
USER() - returns the log-in name
VAL(<expC>) - character to numeric conversion
VERSION() - returns the dBASE IV version number in use
YEAR(<expD>) - year
. 7.1 Sample of Main program
* sample 1
set status off
set menu off
clear
@ 12,13 say "Welcome to dBASE IV programming with kEDITOR"
@ 23, 0 say " "
wait
. 7.2 Sample of Main program calling a procedure
* sample 2
set status off
set talk off
set procedure to procfile
clear
mess = "Edit OK"
do messline with mess
clear
mess = "Edit Bad"
do messline with mess
return
* the following 5 lines should be in a separate file called procfile.prg
procedure messline
parameters string1
@ 23,0 clear
@ 23,5 say "Message Line : " + string1 + " - Press any key to continue"
wait " "
return
* end of procfile file
. 7.3 Sample of horizontal bar and popup menu display and choice selection
* sample 3
procedure mainmenu
********************
* Set up environment
********************
clear all
set clock off
set status off
set talk off
set catalog off
*****************
* Define help key
*****************
on key label F1 do showhelp
*******************
* Define data entry menu
*******************
define popup dataentry from 2,1 to 5,15
define bar 1 of dataentry prompt "Database 1"
define bar 2 of dataentry prompt "Database 2"
on selection popup dataentry do do_choice
*********************
* Define add_del menu
*********************
define popup add_del from 2,15 to 6,30
define bar 1 of add_del prompt "Add New Record"
define bar 2 of add_del prompt "Change Record"
define bar 3 of add_del prompt "Delete Record"
on selection popup add_del do do_choice
*********************
* Define reports menu
*********************
define popup reports from 2,30 to 5,45
define bar 1 of reports prompt "Report 1"
define bar 2 of reports prompt "Report 2"
on selection popup reports do do_choice
*****************
* Define bar menu
*****************
define menu barmenu
define pad dataentry of barmenu prompt "DataEntry" at 1,1;
message "Enter new data to database"
define pad add_del of barmenu prompt "FileUpdate" at 1,15;
message "Add New Record, Change or Delete Existing Record"
define pad reports of barmenu prompt "Reporting" at 1,30;
message "Produce reports"
define pad quit of barmenu prompt "Quit" at 1,45;
message "Return to dBASE IV"
define pad exit of barmenu prompt "Exit" at 1,60;
message "Exit to DOS"
on selection pad dataEntry of barmenu activate popup dataEntry
on selection pad add_del of barmenu activate popup add_del
on selection pad reports of barmenu activate popup reports
on selection pad quit of barmenu do do_quit
on selection pad exit of barmenu do do_exit
activate menu barmenu pad dataentry
return
procedure do_exit
quit
return
procedure do_quit
return to master
return
procedure do_choice
do case
case bar() = 1
do choice1
case bar() = 2
do choice2
endcase
return
. 7.4 Sample of window and popup menu display and choice selection
* sample 4
procedure mainmenu
********************
* Set up environment
********************
clear all
set clock off
set status off
set talk off
set catalog off
********************
* Define help key
********************
on key label F1 do showhelp
*******************
* Define popup menu
*******************
define popup mainmenu from 7,27 to 17,50 message ;
" F1 for Help, Enter first letter of menu choice, or highlight and Enter"
define bar 2 of mainmenu prompt " Choice A"
define bar 4 of mainmenu prompt " Choice B"
define bar 6 of mainmenu prompt " Return to dBASE"
define bar 8 of mainmenu prompt " Quit to DOS"
on selection popup mainmenu do do_choice
***********************************
* Display menu and loop for choices
***********************************
mainloop = .t.
do while mainloop
* show system title lines
clear
@ 1,0 to 3,78 double
@ 2,25 say "System Main Line Control Menu"
activate popup mainmenu
enddo
close all
clear
return
procedure do_choice
do case
case bar() = 2
do choicea
case bar() = 4
do choiceb
case bar() = 6
mainloop = .f.
set color to
return to master
case bar() = 8
mainloop = .f.
set color to
quit
endcase
return
. 7.5 Sample of menu display and choice selection
* sample 5
set talk off
set status off
set intensity off
set delimiter to '[]'
set delimiter on
clear
choice = "4"
@ 5,27 say "Main Menu"
@ 6,27 say "---------"
@ 8,23 say "1 : Add records"
@ 9,23 say "2 : Change records"
@ 10,23 say "3 : Delete records"
@ 11,23 say "4 : Quit"
@ 13,27 say "Select: " get choice
read
do case
case choice = "1"
do addrcd
case choice = "2"
do chgrcd
case choice = "3"
do delrcd
case choice = "4"
quit
endcase
return
. 7.6 Sample of establishing multiple child relations to a parent
* sample 6
select 3
use db3 index db3key
select 2
use db2 index db2key
select 1
use db1 index db1key
set relation to db3key into db3,db2key into db2
. 7.7 Looping construct to move sequentially through a database file
* sample 7
DO WHILE .NOT. EOF()
<statements>...
SKIP
ENDDO
. 7.8 Sample of looping construct to perform repeat until
* sample 8
more = .T.
DO WHILE more
<statements>...
more = (<cond>)
ENDDO
. 7.9 Sample of displaying error message and pause
* sample 9
?? chr(7) && beep
@ 23,0 say 'Key Number not found - ' && display in row 24
wait
@ 23,0 clear
. 7.10 Sample of displaying error message and wait for answer Yes or No
* sample 10
answer = " "
DO WHILE AT(answer,"YyNn") = 0
answer = " "
@ 24,0
set color to
@ 24,17 SAY "Is the above input correct ? (Y/N)" GET answer
READ
@ 24,0
ENDDO
. 7.11 Sample of sequential database access
* sample 11
use ???
do while .not. EOF()
....
skip
enddo
. 7.12 Sample of infinitive loop
* sample 12
DO WHILE .T.
...
ENDDO
. 7.13 Sample of merging partial data from two databases
* sample 13
set safety off
select 3 && merged database file
use db3
zap
select 2 && second database file,samefld are common
use db2 && in db1 and db2
index on samefld to db2
select 1 && first database file
use db1
set relation to samefld into B
DO WHILE .NOT. EOF()
mdb1fld1 = db1fld1
mdb2fld2 = B->db2fld2
select 3
append blank
replace db1fld1 with mdb1fld1
replace db2fld2 with mdb2fld2
select 1
SKIP
ENDDO
. 7.14 Sample of database reporting
* sample 14
use BOOKLIST && database has fields of CODE,NAME,PRICE
set device to print
do while .not. EOF()
@ 3,29 say "MY BOOK LIST"
@ 4,29 say "------------"
@ 6,14 say "CODE NAME PRICE"
@ 7,14 say "---- -------------------- -------"
line = 8
do while line < 60 .and. .not. EOF()
@ line ,14 say CODE
@ line ,24 say NAME
@ line ,48 say PRICE
line = line + 1
skip
enddo
eject
enddo
set device to screen
. 8. Key Tables
Navigation keys
Leftarrow/Ctrl-S
Rightarrow/Ctrl-D
Ctrl-Leftarrow/Ctrl-A
Ctrl-Rightarrow/Ctrl-F
Uparrow/Ctrl-E
Downarrow/Ctrl-X/Return/Ctrl-M
Home/End
Ctrl-Home/Ctrl-End
Editing keys
Del/Ctrl-G
Backspace/Ctrl-H
Ctrl-T
Ctrl-Y
Ctrl-U
Escape keys
Ctrl-W/Ctrl-C/PgUp/PgDn
Return/Ctrl-M
Esc
Mode keys
Ins/Ctrl-V
. 9. File Types
Data Base File (.DBF)
Index File (.NDX)
Alternate (.TXT)
Command (.PRG)
Format (.FMT)
Label (.LBL)
Memory (.MEM)
Report (.FRM)
Memo (.DBT)
VisiCalc (.DIF)
Framework II (.FW2)
RapidFile (.RPD)
System Data Format (.SDF)
Multiplan (.SYL)
Lotus 1-2-3 Release 1A (.WKS)
Lotus 1-2-3 Release 2.x (.WK1)
.10.1 SQL Commands
ALTER TABLE <table-name> ADD (<column-name> <data-type>[,...]);
CLOSE <cursor-name>;
CREATE DATABASE [path] <database>;
CREATE [UNIQUE] INDEX <index-name> ON <table-name> (<column-name> [ASC/DES]...);
CREATE SYNONYM <synonym-name> FOR <table-name>;
CREATE TABLE <table-name> (<column-name> <data-type>[,...]);
CREATE VIEW <view-name>[(<column-list>)] AS subselect [WITH CHECK OPTION];
DBCHECK [<table-name>];
DBDEFINE [<.dbf-file>];
DECLARE <cursor-name> CURSOR FOR <SELECT statememt>
/<ORDER BY clause>];
DELETE FROM <table-name> [WHERE <clause>];
DELETE FROM <table-name> WHERE CURRENT OF <cursor-name>;
DROP DATABASE <database>;
DROP INDEX <index-name>;
DROP SYNONYM <synonym-name>;
DROP TABLE <table-name>;
DROP VIEW <view-name>;
FETCH <cursor-name> INTO <variable-list>;
GRANT ALL [PRIVILEGES]/<privileges-list> ON {TABLE] <table-list> TO PUBLIC/
<user-list> [WITH GRANT OPTION];
INSERT INTO <table-name> [(<column-list>)] VALUES (<value-list>);
INSERT INTO <table-name> [(<column-list>)]<subselect>;
LOAD DATA FROM [path] <filename> INTO TABLE <table-name> [[TYPE] SDF/DIF/WKS/SYK
/FW2/RPD/DBASEII/DELIMITED [WITH BLANK/WITH <delimiter>]];
OPEN <cursor-name>;
REVOKE ALL [PRIVILEGES]/[privileges-list> ON [TABLE] <table-name> FRON PUBLIC/
<user-list>;
ROLLBACK [WORK];
RUNSTATS [<table-name>];
.11. Config.DB keywords
- Configuration commands
BUCKET =<1K to 31K>
COMMAND =<dBASE IV command>
DO =<1 to 256>
EEMS =ON/off
EXPSIZE =<100 to 2000>
FASTCRT =ON/off
FILES =<15 to 99>
GETS =<35 to 1023>
INDEXBYTES =<2K TO 128K>
PDRIVER =<printer driver filename>
PROMPT =<up to 19 characters,default .>
RESETCRT =ON/off
SQLDATABASE =<SQL database name>
SQLHOME =<path name>
TEDIT =<program editor>
WP =<ASCII text editor>
- Memory Block Size Allocation
MVMAXBLKS =<1 to 150,default 10>
MVBLKSIZE =<25 to 100,default 50>
RTMAXBLKS =<1 to 150,default 10>
RTBLKSIZE =<25 to 100,default 50>
CTMAXSYMS =<1 TO 5000,default 500>
- Function Keys Definitions
F1 =<expC,default HELP;*>
F2 =<expC,default ASSIST;>
F3 =<expC,default LIST;>
F4 =<expC,default DIR;>
F5 =<expC,default DISPLAY STRUCTURE;>
F6 =<expC,default DISPLAY STATUS;>
F7 =<expC,default DISPLAY MEMORY;>
F8 =<expC,default DISPLAY;>
F9 =<expC,default APPEND;>
F10 =<expC,default EDIT;>
SHIFT-F10 =<expC,default MACRO MENU *>
_ Set Commands
ALTERNATE =on/OFF
ALTERNATE =<filename>
AUTOSAVE =on/OFF
BELL =ON/off
BELL =<freq. 19 to 10000,default 512HZ,
duration 2 to 19,default 2>
BLOCKSIZE =<1 to 32,default 1(512K)>
BORDER =<SINGLE/double/panel/none/border definition string>
CARRY =<on/OFF>
CATALOG =<on/OFF>
CENTURY =<on/OFF>
CLOCK =<on/OFF>
CLOCK =<row,column,default 0,69>
COLOR =<<ON/off>
COLOR =[<standard>][,[enhanced>][,[<perimeter>][,[background>]]]]
CONFIRM =<on/OFF>
CONSOLE =<ON/off>
CURRENCY =<expC,default $
CURRENCY =<LEFT/right>
DATE =<AMERICAN/ansi/british/french/german/italian/japan/usa/mdy/
dmy/ymd>
DEBUG =<on/OFF>
DECIMALS =<0 to 18,default 2>
DEFAULT =<expC,default drive name>
DELIMITERS =<on/OFF>
DESIGN =<expC,default :>
DEVELOPMENT =<ON/off>
DEVICE =<SCREEN/printer/filename>
DISPLAY =<MONO/COLOR/EGA25/EGA43/MONO43>
ECHO =<on/OFF>
ENCRYPTION =<on/OFF>
ESCAPE =<ON/off>
EXACT =<on/OFF>
EXCLUSIVE =<on/OFF>
FULLPATH =<on/OFF>
FUNCTION =<expN,expC>
HEADING =<ON/off>
HELP =<ON/off>
HISTORY =<ON/off>
HISTORY =<0 to 16000,default 20>
HOURS =<12/24,default 12>
INSTRUCT =<ON/off>
INTENSITY =<ON/off>
LOCK =<ON/off>
MARGIN =<0 to 254,default 0
MEMOWIDTH =<8 to 32000,default 50
MENUS =<ON/off>
NEAR =<on/OFF>
ODOMETER =<1 to 200,default 1>
PATH =<path name>
PAUSE =<on/OFF>
POINT =<expC,default .,numbers and space not allowed>
PRECISION =<10 to 20,default 16>
PRINTER =<on/OFF>
PRINTER =<PRN/lpt1/lpt2/lpt3/com1/com2>
REFRESH =<0 to 36000,default 0>
REPROCESS =<-1 to 32000,default 0>
SAFETY =<ON/off>
SCOREBOARD =<ON/off>
SEPARATOR =<expC,default ,>
SPACE =<ON/off>
SQL =<on/OFF>
STATUS =<on/OFF>
STEP =<on/OFF>
TABS =<expC,default "">
TALK =<ON/off>
TRAP =<on/OFF>
TYPEAHEAD =<0 to 32000,default 20>
UNIQUE =<on/OFF>
VIEW =<query filename/view filename>
.12. Limitations
- Database file
-- Number of records : 1 billion
-- Number of bytes : 2 billion
-- 10 work areas for 10 databases to be opened at one time.
-- 255 fields per database
-- Maximum size of a record : 4,000 bytes
- Maximum number of open index file per database is 11.
- Each multiple index file can include up to 47 index tags.
- Up to 25,000 memory variables may be set in Config.db file(default 500).
- Command line length:255 char in dot command,1,024 bytes in edit window.
- Maximum number of GET commands in a format file is 2000.
- Up to 16,000 commands can be set in SET HISTORY command.
- Up to 1,170 procedures in a procedure file.
- Up to 16 binary programs loaded with each up to 32,000 bytes long.
- The pop-up window column to 79,row to 21.
- Up to 20 window definitions in memory at one time.
- Up to 50 parameters to be passed to a subroutine.
- The memo width is from 5 to 250.
- Up to 32 .dbo files can be active at one time.
- Maximum length of the key expression is 220 characters. The maximum length
of the key, result of the evaluated index key expression is 100 characters
- Create up to 35 unique macro keys.
- Maximum number of programmable function keys is 29
.13. PICTURE Symbols (Functions and Template)
Function Symbols
----------------
Function Action
A alphabetic characters only
B left-justified text
C displays CR(credit) after positive numbers
D date in American format
E date in European format
I centers text
J right-justified text
L displays leading zeros
M allows a list of choices for a GET variable
R display in template but not enter into field
S<n> allows horizontal scrolling with a GET field width <n>
T trims leading and trailing blanks
X displays DB(debit) after negative numbers
Z displays zero as blank
( encloses negative numbers in parentheses
! converts alphabetic characters to upper case
Template Symbols
----------------
Template Action
A letters only
L logical data only
N letters and digits
X any character
Y allows only "Y" or "N",converts "y" or "n" to upper case
9 digits for any data type including sign for numeric
# displays digits,signs, and spaces for any data type
! converts an alphabetic character to upper case
$ displays SET CURRENT string in leading space of a numeric
. specifies a decimal point position
, specifies a comma position